<?php
namespace app\tools\controller;
use app\tools\logic\ApiLogic;
use app\tools\logic\ChannelServerLogic;

class ChannelServer extends Base{
	//获取列表
	function getList(){
		$data = ChannelServerLogic::getList();
		return ApiLogic::return(0,'',$data);
	}
	//获取详情
	function getInfo(){
		$info = ChannelServerLogic::getInfo();
		return ApiLogic::return(0,'',$info);
	}
	//保存
	function save(){
		$rs = ChannelServerLogic::save();
		if($rs){
			return ApiLogic::return($rs);
		}else{
			return ApiLogic::return(0);
		}
	}
	//新增
	function add(){
		$rs = ChannelServerLogic::add();
		if($rs){
			return ApiLogic::return($rs);
		}else{
			return ApiLogic::return(0);
		}
	}

	//删除
	function delete(){
		$rs = ChannelServerLogic::delete();
		if($rs){
			return ApiLogic::return($rs);
		}else{
			return ApiLogic::return(0);
		}
	}

	function addList(){
		$rs = ChannelServerLogic::addList();
		if($rs['code']!=0){
			return ApiLogic::return($rs['code']);
		}else{
			$msg = "";
			if($rs['cf']>0){
				$msg .= "缺少服务名或者服务代号".$rs['cf'].'个已忽略 ';
			}
			if($rs['cg']>0){
				$msg .=" 成功导入/修改服务".$rs['cg'].'个';
			}
			return ApiLogic::return(0,$msg);
		}
	}

}
